#include<stdio.h>
#include<unistd.h>
#include<stdlib.h>
#include<signal.h>

void show_set(sigset_t* set)
{
  int i = 1;
  for(i = 1;i<=31;i++)
  {
    printf("%d",sigismember(set,i));
  }
  printf("\n");
}


int main()
{
  sigset_t set;
  sigemptyset(&set);//初始化置空
  sigaddset(&set,2);
  sigaddset(&set,4);
  sigaddset(&set,5);
  sigprocmask(SIG_BLOCK,&set,NULL);
  sigset_t oset;
  while(1)
  {
    sigemptyset(&oset);
    sigemptyset(&set);
    sigprocmask(SIG_UNBLOCK,NULL,&set);
    sigpending(&oset);
    printf("The pending is :");
    show_set(&oset);
    printf("The block is :");
    show_set(&set);
    sleep(1);
  }
  return 0;
}
